import Vue from 'vue'
import Router from 'vue-router'
import LoginEntry from '@/components/loginEntry'
import Block from '@/components/block'
import newLogin from '@/components/newLogin'
import newBlock from '@/components/newBlock'
Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    { path: '/', redirect: { name: 'newLogin' } },
    // { path: '/loginEntry', name: 'loginEntry', component: LoginEntry },
    { path: '/block', name: 'block', component: Block },
    { path: '/newlogin', name: 'newLogin', component: newLogin },
    { path: '/newblock', name: 'newBlock', component: newBlock },
  ]
})

/**
 * 重写路由的push方法
 */
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error => error)
}
